import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    redirect:'/home'
  },
  {
    path: "/login",
    name: 'login',
    component: ()=>import('../views/login/index.vue')
  },
  {
    path: "/home",
    name: 'home',  
    meta:{title: '首页'},     //这个实际上是mainbox页面 =布局页
    redirect:'/index',
    component: ()=>import('../views/home/index.vue'),
    children: [
      {
        path: '/index',
        name: 'index', 
        meta:{title: '首页'},          //这才是内部首页
        component: ()=>import('../views/home/index/index.vue')
      },
      {
        path: '/stats',
        name: 'stats',
        meta:{title: '数据管理'}, 
        component:() =>import('../views/home/stats/index.vue')
      },
      {
        path: '/wms',
        name: 'wms',
        meta:{title: '信息管理'}, 
        component: ()=> import('../views/home/wms/index.vue'),
        children:[
          {
            path: '/wms/list',
            name: 'wmsList',
            meta:{title: '信息列表'}, 
            component:()=> import('../views/home/wms/list.vue')
          }

        ]
      },
      {
        path: '/user',
        name: 'user',
        meta:{title: '用户管理'}, 
        component: ()=> import('../views/home/user/index.vue'),
        children:[
          {
            path: '/user/stats',
            name: 'userstats',
            meta:{title: '用户统计'}, 
            component:()=> import('../views/home/user/stats.vue')
          },
          {
            path: 'role',
            name : 'role',
            meta:{title: '角色统计'}, 
            component: ()=> import('../views/home/user/role.vue')
          }
        ]
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
